package studychinese.model;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.hschinese.pronunciation.R;

import studychinese.activity.LeaveMessageActivity;


public class CustomDialogg extends Dialog implements View.OnClickListener{
    int layoutRes;// 布局文件
    Context context;
    /** 确定按钮 **/
    private Button confirmBtn;
    public CustomDialogg(Context context) {
        super(context);
        this.context = context;
    }



    /**
     * 自定义布局的构造方法
     *
     * @param context
     * @param resLayout
     */
    public CustomDialogg(Context context, int resLayout) {
        super(context);
        this.context = context;
        this.layoutRes = resLayout;

    }



    /**
     * 自定义主题及布局的构造方法
     *
     * @param context
     * @param theme
     * @param resLayout
     */
    public CustomDialogg(Context context, int theme, int resLayout) {
        super(context, theme);
        this.context = context;
        this.layoutRes = resLayout;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(layoutRes);

        // 根据id在布局中找到控件对象
        confirmBtn = (Button) findViewById(R.id.feedback_confirm_btn);

        // 为按钮绑定点击事件监听器
        confirmBtn.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch(v.getId()){

            case R.id.feedback_confirm_btn:
                ((LeaveMessageActivity)context).finish();
                dismiss();
                break;
        }
    }




}
